package io.renren.modules.PCguanli.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.PCguanli.entity.LineDeptEntity;
import io.renren.modules.PCguanli.service.LineDeptService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 排队部门表
 *
 * @author zhangdanxiaozu
 * @email dan.zhang@zju.edu.cn
 * @date 2024-03-30 18:50:58
 */
@RestController
@RequestMapping("PCguanli/linedept")
public class LineDeptController {
    @Autowired
    private LineDeptService lineDeptService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("PCguanli:linedept:list")
    public List<LineDeptEntity> list(@RequestParam Map<String, Object> params){
        List<LineDeptEntity> list= lineDeptService.list(params);
        return list;
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{deptId}")
    @RequiresPermissions("PCguanli:linedept:info")
    public R info(@PathVariable("deptId") Integer deptId){
		LineDeptEntity lineDept = lineDeptService.getById(deptId);

        return R.ok().put("lineDept", lineDept);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("PCguanli:linedept:save")
    public R save(@RequestBody LineDeptEntity lineDept){
		lineDeptService.save(lineDept);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("PCguanli:linedept:update")
    public R update(@RequestBody LineDeptEntity lineDept){
		lineDeptService.updateById(lineDept);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("PCguanli:linedept:delete")
    public R delete(@RequestBody Integer[] deptIds){
		lineDeptService.removeByIds(Arrays.asList(deptIds));

        return R.ok();
    }

}
